<?php
/**
 * 权限管理控制器
 * User: Administrator
 * Date: 2017/11/20
 * Time: 15:06
 */
namespace app\admin\controller;
use think\Controller;
use think\Db;

class Privilege extends Common {

    public function _initialize(){
        //定义系统的编码
        header("Content-Type:text/html; charset=utf-8");
        header('Content-Type:app/json; charset=utf-8');
        //登录ID
        $this->user_id = session('uid');
    }


    /**
     * 权限列表
     */
    public function lst(){



        return $this->fetch();
    }

    /**
     * 添加权限
     */
    public function add(){

        if(request()->isPost()){
            $data = input('post.');
           // halt($data);exit;
            //接收表单数据并传入模型
            $res = (new \application\common\model\Privilege())->add(input('post.'));

//            $validate = Loader::validate('Privilege');
//            if(!$validate->check($data)){
//                dump($validate->getError());
//            }
            echo '2222';
        }

        return $this->fetch();
    }

}